package com.example.communitypro.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

public class UserSearchHistory implements Serializable {
    private Integer searchHistoryNo;

    private Integer userNo;

    private Integer searchObjectNo;

    private Integer searchObjectType;
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date searchTime;

    private static final long serialVersionUID = 1L;

    public Integer getSearchHistoryNo() {
        return searchHistoryNo;
    }

    public void setSearchHistoryNo(Integer searchHistoryNo) {
        this.searchHistoryNo = searchHistoryNo;
    }

    public Integer getUserNo() {
        return userNo;
    }

    public void setUserNo(Integer userNo) {
        this.userNo = userNo;
    }

    public Integer getSearchObjectNo() {
        return searchObjectNo;
    }

    public void setSearchObjectNo(Integer searchObjectNo) {
        this.searchObjectNo = searchObjectNo;
    }

    public Integer getSearchObjectType() {
        return searchObjectType;
    }

    public void setSearchObjectType(Integer searchObjectType) {
        this.searchObjectType = searchObjectType;
    }

    public Date getSearchTime() {
        return searchTime;
    }

    public void setSearchTime(Date searchTime) {
        this.searchTime = searchTime;
    }

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        UserSearchHistory other = (UserSearchHistory) that;
        return (this.getSearchHistoryNo() == null ? other.getSearchHistoryNo() == null : this.getSearchHistoryNo().equals(other.getSearchHistoryNo()))
                && (this.getUserNo() == null ? other.getUserNo() == null : this.getUserNo().equals(other.getUserNo()))
                && (this.getSearchObjectNo() == null ? other.getSearchObjectNo() == null : this.getSearchObjectNo().equals(other.getSearchObjectNo()))
                && (this.getSearchObjectType() == null ? other.getSearchObjectType() == null : this.getSearchObjectType().equals(other.getSearchObjectType()))
                && (this.getSearchTime() == null ? other.getSearchTime() == null : this.getSearchTime().equals(other.getSearchTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getSearchHistoryNo() == null) ? 0 : getSearchHistoryNo().hashCode());
        result = prime * result + ((getUserNo() == null) ? 0 : getUserNo().hashCode());
        result = prime * result + ((getSearchObjectNo() == null) ? 0 : getSearchObjectNo().hashCode());
        result = prime * result + ((getSearchObjectType() == null) ? 0 : getSearchObjectType().hashCode());
        result = prime * result + ((getSearchTime() == null) ? 0 : getSearchTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", searchHistoryNo=").append(searchHistoryNo);
        sb.append(", userNo=").append(userNo);
        sb.append(", searchObjectNo=").append(searchObjectNo);
        sb.append(", searchObjectType=").append(searchObjectType);
        sb.append(", searchTime=").append(searchTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}